{extend name="common:base"/}
{block name="body"}
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-12">
        <h2>系统</h2>
    </div>
</div>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="panel blank-panel panel-heading background-fff">
                <div class="panel-options">
                    {present name="type"}
                    <ul class="nav nav-tabs">
                        {volist name='type' id='group'}
                        <li class="{eq name='group_id' value='$key'}active{/eq}">
                            <a href="{:\\think\\Url::build('group',['id'=>$key])}">{$group}配置</a>
                        </li>
                        {/volist}
                    </ul>
                    {/present}
                </div>
                <div class="tab-content">
                    <div id="tab-1" class="tab-pane active">
                        <form action="{:\\think\\Url::build('setUp')}" method="post" id="signupForm" class="form-horizontal">
                            {volist name="list" id="config"}
                            <div class="m-b-sm m-t-sm">
                                <label class=" control-label">{$config.title}<span class="check-tips">({$config.remark})</span></label>
                                {switch name="config.type"}
                                {case value="0"}
                                <input id="url" class="form-control input-small" type="text" name="config[{$config.name}]" value="{$config.value|default=''}">
                                {/case}
                                {case value="1"}
                                <input id="url" class="form-control input-large" type="text" name="config[{$config.name}]" value="{$config.value|default=''}">
                                {/case}
                                {case value="2"}
                                <textarea name="config[{$config.name}]" class="form-control input-large" rows="4">{$config.value|default=''}</textarea>
                                {/case}
                                {case value="3"}
                                <textarea name="config[{$config.name}]" class="form-control input-large" rows="4">{$config.value|default=''}</textarea>
                                {/case}
                                {case value="4"}
                                <select name="config[{$config.name}]"  class="form-control input-3x" >
                                    {notempty name='config.extra'}
                                    {volist name=":parse_config_attr($config['extra'])" id="vo"}
                                    <label><option value="{$key}" {eq name='config.value' value='$key'}selected{/eq}>{$vo}</option></label>
                                    {/volist}
                                    {/notempty}
                                </select>
                                {/case}
                                {/switch}
                            </div>
                            {/volist}
                            <div class="m-b-sm m-t-sm">
                                <button class="btn btn-w-m btn-primary" {empty name='list'}disabled{/empty} type="submit">提交</button>
                                <button class="btn btn-w-m btn-default retreat">取消</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__JS__/detail.js"></script>
<script src="__JS__/plugins/validate/jquery.validate.min.js"></script>
<script src="__JS__/plugins/validate/messages_zh.min.js"></script>
<script type="text/javascript">
    highlight_subnav("{:\\think\\Url::build('Deploy/group')}");
    $("#signupForm").validate({
        rules: {
            name: {
                required: true,
                minlength: 2
            },
            title: "required"
        },
        messages: {
            name: {
                required: '配置名称不能为空',
                minlength: '至少两个字符以上'
            },
            title: {
                required: "标题不能为空"
            }
        },
        submitHandler: function () {
            validateAjax("#signupForm", "button[type='submit']");
            return false;
        }
    });
</script>
{/block}